You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
gpu-config [1/13]: add the GPU configuration state file - #3247
Adds internal/gpuconfig/statefile: the node-local state file and lock that
the GPU configuration manager and the gpu-config init container use to
record the decision and the gate pass for each driver load. Not used yet.
The change adds a versioned JSON state model with parsing, state predicates, and config lookup. It adds a store that reads state files and provides blocking and nonblocking advisory locks. Locked writes record apply decisions or gate passes, preserve other top-level keys, and replace the state file through a temporary file. Tests cover parsing, predicates, locking, write behavior, and timestamps.
Estimated code review effort:
Merge Risk: Low · up to 1b629
This adds a node-local GPU state file that nothing uses yet, so production exposure is minimal. A hand-edited file with duplicate version keys could be accepted on read and then become unreadable after the next write. Fixing that edge case, or rejecting ambiguous duplicate fields, is worthwhile before the state file is wired in.
Security architecture risk: Minimal · up to 1b629
The new state-storage contract merits review, but this change does not connect it to running GPU configuration or allocation flows. The inspected locking, read-before-write and atomic-replacement behavior establishes no material security, failure-containment or ownership regression.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The established scope is the node-local state store, not an exposed network or tenant API. The PR explicitly defers production use, and the supplied reachability summary reports no downstream files outside the package. Future integration could make these records authoritative for GPU allocation, but that exposure is not introduced here.
Trust Boundaries and Controls
observed — File contents cross into typed state through JSON decoding and version validation. Unknown decision values do not satisfy Decided, and WriteApply rejects values other than applied or skipped. Correct load identity remains a caller contract: WriteGatePass documents the required load relationship but does not verify it.
Resilience and Maintainability Implications
observed — Acquisition retries interrupted flock operations and closes the file on acquisition failure. A failed locked read invalidates the write base, and writes after unlock are rejected. These controls prevent cooperating sequential holders from carrying a stale read across failed validation or a completed lock hold.
Hardening Proposals
proposed — Before production integration, explicitly establish trusted directory ownership and mount permissions, single-owner use of each Lock, and the source of current-load identity. Validate those responsibilities where the manager and gate acquire authority over this store.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
The reason will be displayed to describe this comment to others. Learn more.
Note
Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.
Other comments: 1
internal/gpuconfig/statefile/state.go: 1
101-101: Minor · Data Integrity & Integration · Quick win
Keep the decoded state consistent with the retained JSON.
{"version":1,"version":null} passes the first decode with Version == 1, but this decode retains version:null. Go leaves a scalar unchanged when decoding null. (raw.githubusercontent.com)
After a successful Lock.Read, WriteGatePass copies that null version into the replacement file. It then returns ErrParse after the rename. Subsequent reads also fail.
Derive State from the retained representation, or reject ambiguous duplicate fields before accepting the file. Add a read–write regression test.
This test starts with l.base == nil. It still passes if Lock.Read stops clearing a previous successful base after an error.
First perform a successful l.Read. Then replace the fixture with {"version":2}, repeat the read, and keep the write-rejection and unchanged-file assertions. This catches a stale base that could overwrite an unreadable file.
As per path instructions, “Flag assertions that would still pass if the behavior under test were broken.”
Reviewing files that changed from the base of the PR and between 246a9ca and 1b62959.
Files selected for processing: 4
internal/gpuconfig/statefile/file.go
internal/gpuconfig/statefile/file_test.go
internal/gpuconfig/statefile/state.go
internal/gpuconfig/statefile/state_test.go
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
henry118
changed the title
gpu-config: add the GPU configuration state file
gpu-config [1/13]: add the GPU configuration state file
Nov 19, 2026
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #3246 (1/13). Depends on: none.
Adds
internal/gpuconfig/statefile: the node-local state file and lock thatthe GPU configuration manager and the
gpu-configinit container use torecord the decision and the gate pass for each driver load. Not used yet.